/*
 * string_manip.cpp
 *
 *  Created on: 3 mar 2010
 *      Author: Andreas
 */

#include <string>
#include <vector>
#include "string_manip.h"

vector<string> split(string str, string delim) {
        int cutAt;
        vector<string> results;

        while( (cutAt = str.find_first_of(delim)) != str.npos ) {
                if(cutAt > 0) {
                        results.push_back(str.substr(0,cutAt));
                }
                str = str.substr(cutAt+1);
        }
        if(str.length() > 0) {
                results.push_back(str);
        }

        return results;
}

int toi(string str){
        return atoi(str.c_str());
}
